<template>
	<view>
		<view class="search-box flex">
			<input class="search-inp" type="text" value="" placeholder="请输入小组名称" />
			<view class="search-btn">搜索</view>
		</view>
		<view v-if="taskArray.length > 0">
			<recruitmentSmallgroup :items="taskArray"></recruitmentSmallgroup>
		</view>
		<loading v-else-if="firstload"></loading>
		<!-- 无内容默认 -->
		<no-thing v-else></no-thing>
	</view>
</template>

<script>
	import loading from "../../components/common/loading.vue";
	import noThing from "../../components/common/no-thing.vue";
	import recruitmentSmallgroup from '../../components/item/recruitment-smallgroup-items.vue'
	export default {
		data() {
			return {
				taskArray: [],
				firstload: true,
			}
		},
		methods: {
			// 请求后台数据
			async reqData() {
				// 取token
				try {
					const value = uni.getStorageSync('login_key');
					if (value) {
						this.token = value;
					}
				} catch (e) {
					// error
				}
				// 发请求
				let url = this.ServicesApi.getRecruitTeam;
				let data = {};
				let result = await this.Services.post(url, data);
				if (result.code == this.StatusCode.SUCCESS_CODE) {
					this.taskArray = result.data.data;
					this.firstload = false;
				} else {
					this.firstload = false;
				}
				// uni.request({
				//     url: this.ServicesApi.getRecruitTeam,
				// 	method:'GET',
				// 	header: {
				// 		"content-type":"application/x-www-form-urlencoded"
				// 	},
				// 	data:{
				// 		token:this.token,
				// 	},
				//     success: (res) => {
				// 		// console.log("shenme", res.data);
				// 		if(res.data.code == 1){
				// 			this.taskArray = res.data.data;
				// 			this.firstload = false;
				// 		}else{
				// 			this.firstload = false;
				// 		}
				//     }
				// });
			}
		},
		components: {
			recruitmentSmallgroup,
			loading,
			noThing,
		},
		mounted() {
			this.reqData();
		}
	}
</script>

<style scoped lang="stylus">
	.search-box {
		height: 100upx;
		background: #E7E7E7;
		align-items: center;
		padding: 0 40upx;
		justify-content: space-between;

		.search-inp {
			height: 60upx;
			width: 594upx;
			border-radius: 4upx;
			background: #fff;
		}

		.search-btn {
			font-size: 30upx;
			color: #333333;
		}
	}
</style>
